<!--内容赋值-->
<?php
$this->title="选择送货地址";
$this->context->bodyClass="page-order-address-list";
$defalutId = Yii::$app->request->get('uid');
$cart_ids = Yii::$app->request->get('cart_ids');
?>
<!--加载样式-->
<?php $this->beginBlock('css');?>
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="<?=Yii::getAlias('@static')?>/wap/liketry/css/cart.css">
<?php $this->endBlock();?>
<!--开始头部-->

<header>
    <div class="header-left" id="back"><span class="icon icon-arrow-left"></span></div>
    <h1>选择送货地址</h1>
    <div class="header-right"><a href="<?=Yii::$app->urlManager->createUrl(["member-address/list"]);?>">管理</a></div>
</header>
<section class="order-address-list" id="orderAddressList">
    <ul>
        <?php if(count($info) > 0): ?>
            <?php foreach($info as $key=>$val):?>
                <li <?php if($val['uid'] ==$defalutId):?>class="selected"<?php endif ;?> uid="<?=$val['uid']?>">
                <p><i><?=$val['consignee']?></i><i><?=$val['cell']?></i><br><i><?=$val['s1']?></i><i><?=$val['s2']?></i><i><?=$val['s3']?></i><br><i><?=$val['address']?></i></p>
                <div class="radio"></div>
                    <?php if($val['is_default'] ==1):?>
                        <div class="address-default" style="display:block;">默认</div>
                    <?php endif ;?>
                <div class="address-edit"><a href="<?=Yii::$app->urlManager->createUrl(["member-address/edit",'uid'=>$val['uid']]);?>"><span class="icon icon-edit"></span></a></div>
                </li>
            <?php endforeach;?>

        <?php endif;?>

    </ul>
</section>
<div class="bottom-btn"><a href="<?=Yii::$app->urlManager->createUrl(["member-address/add",'cart_ids'=>$cart_ids]);?>">+新增收货地址</a></div>
<form id="addressForm" method="get" action="<?=Yii::$app->urlManager->createUrl(['order']);?>">
<input name="_csrf" type="hidden" id="_csrf" value="<?= Yii::$app->request->csrfToken ?>">
<input type="hidden" name="cart_ids" value="<?= Yii::$app->request->get('cart_ids') ?>">
<input type="hidden" name="uid" value="">
</form>
<!--加载js-->
<?php $this->beginBlock('js');?>

<script src="<?= Yii::getAlias('@static') ?>/wap/common/js/zepto.min.js"></script>
<script src="<?= Yii::getAlias('@static') ?>/wap/common/js/fastclick.min.js"></script>
<script src="<?= Yii::getAlias('@static') ?>/wap/common/js/king.wap.js"></script>

<script>
    $(function(){
        $("#back").on("click", function(){
			$.go(-1);
		});
        //地址单选
        $("#orderAddressList").on("click", "a", function(e){
			e.stopImmediatePropagation();
		}).on("click", "li", function(){
			$.loader("已选择,页面跳转中...");
			$("[name='uid']").val($(this).attr("uid"));
            $(this).addClass("selected").siblings().removeClass("selected");
            $("#addressForm").submit();
        })
    })
</script>
<?php $this->endBlock();?>
